#pragma once
#include <iostream>
#include <vector>
#include <utility>
#include <sstream>
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>

using namespace std;

class K3M_Algorithm
{
public:
	K3M_Algorithm(void);
	void run(IplImage *source);
	virtual ~K3M_Algorithm(void);
private:
	
	vector< pair<int,int> > borders;
	
	static int N[3][3];
	static int A0[48];
	static int A1[8];
	static int A2[15];
	static int A3[24];
	static int A4[32];
	static int A5[36];
	static int A1pix[48];

	void marking_borders(IplImage *source);
	bool phase1(IplImage *source);
	bool phase2(IplImage *source);
	bool phase3(IplImage *source);
	bool phase4(IplImage *source);
	bool phase5(IplImage *source);
	void thinning_to_one_pixel_skeleton(IplImage *source);



};

